package vip.xiaonuo.megvii.facegroups.delete;

import org.springframework.stereotype.Service;
import vip.xiaonuo.megvii.facegroups.delete.impl.DeleteFaceGroupDropFace;
import vip.xiaonuo.megvii.facegroups.delete.impl.DeleteFaceGroupSaveFace;
import vip.xiaonuo.megvii.facegroups.delete.impl.DeleteFaceGroupSaveGroup;
import vip.xiaonuo.modular.megviifacegroup.entity.MegviiFaceGroup;

import javax.annotation.Resource;

@Service
public class FaceDeleteCenter {

    @Resource
    private DeleteFaceGroupDropFace dropFaceService;

    @Resource
    private DeleteFaceGroupSaveFace saveFaceService;

    @Resource
    private DeleteFaceGroupSaveGroup saveGroupService;

    private FaceGroupDeleteStrategy getStrategy(int mode){
        switch (mode){
            case 1:
                return saveFaceService;
            case 2:
                return dropFaceService;
            case 3:
                return saveGroupService;
        }
        return null;
    }

    public void doDelete(int deleteMode, MegviiFaceGroup faceGroup){
        FaceGroupDeleteStrategy strategy = this.getStrategy(deleteMode);
        strategy.delete(faceGroup);
    }

}
